home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / TURB_VIS / ALEXLEVI / DEMO / DEMO_KBD.PAS < prev    next >
Pascal/Delphi Source File  |  1994-04-12  |  3KB  |  71 lines

  1.  
  2. (*
  3.  
  4. ****************************************************************************
  5. *                                                                          *
  6. *      This function was made by Alex Levitas' "Keyboard Map Editor".      *
  7. *                                                                          *
  8. ****************************************************************************
  9.  
  10.  This function convert single character from standard keyboard map to new.
  11.  
  12.  May be used after reading single character from keyboard. Use 
  13.  ConvertChar(ReadKey) call instead of ReadKey call.
  14.  
  15.  To use this function in your program, insert the directive
  16.  
  17.     {$I DEMO_KBD.PAS}
  18.  
  19.  If you want to use more than one keyboard map in your program, you
  20.  must change function name in each source file.
  21.  
  22. *)
  23.  
  24. function ConvertChar(PressedChar: Char): Char;
  25. const
  26.  
  27.   PreviousChar: Char = #255;
  28.  
  29. const
  30.  
  31.   KeyboardChars: String[92] = (
  32.                                #126#096#033#049#064#050#035#051#036#052 +
  33.                                #037#053#094#054#038#055#042#056#040#057 +
  34.                                #041#048#095#045#043#061#081#113#087#119 +
  35.                                #069#101#082#114#084#116#089#121#085#117 +
  36.                                #073#105#079#111#080#112#123#091#125#093 +
  37.                                #065#097#083#115#068#100#070#102#071#103 +
  38.                                #072#104#074#106#075#107#076#108#058#059 +
  39.                                #034#039#090#122#088#120#067#099#086#118 +
  40.                                #066#098#078#110#077#109#060#044#062#046 +
  41.                                #063#047
  42.                                );
  43.  
  44.   Convert_Chars: String[92] = (
  45.                                #126#096#033#049#034#050#058#051#047#052 +
  46.                                #037#053#044#054#046#055#063#056#040#057 +
  47.                                #041#048#095#045#043#061#137#169#150#230 +
  48.                                #147#227#138#170#133#165#141#173#131#163 +
  49.                                #152#232#153#233#135#167#149#229#154#234 +
  50.                                #148#228#155#235#130#162#128#160#143#175 +
  51.                                #144#224#142#174#139#171#132#164#134#166 +
  52.                                #157#237#159#239#151#231#145#225#140#172 +
  53.                                #136#168#146#226#156#236#129#161#158#238 +
  54.                                #240#241
  55.                               );
  56.  
  57. var
  58.  
  59.   TmpCh: Char;
  60.  
  61. begin
  62.   ConvertChar := PressedChar;
  63.   TmpCh := PreviousChar;
  64.   PreviousChar := PressedChar;
  65.   if TmpCh = #0 then Exit;
  66.   if Pos(PressedChar, KeyboardChars) <> 0 then
  67.     if Convert_Chars[Pos(PressedChar, KeyboardChars)] <> #0 then
  68.       ConvertChar := Convert_Chars[Pos(PressedChar, KeyboardChars)];
  69. end;
  70.  
  71.